package com.newgrand.annexcommon.utils;

import com.newgrand.annexcommon.constant.Constants;
import com.newgrand.annexcommon.model.Result;

public class ResultUtil {

    public static Result success() {
        return success(null);
    }

    public static Result success(Object data) {
        Result ret = new Result();
        ret.setCode(Constants.RESPONSE_SUCCESS_CODE);
        ret.setMessage(Constants.RESPONSE_SUCCESS_MEG);
        ret.setData(data);
        return ret;
    }


    public static Result success(int code, String msg) {
        Result ret = new Result();
        ret.setCode(code);
        ret.setMessage(msg);
        return ret;
    }

    public static Result success(int code, Object data) {
        Result ret = new Result();
        ret.setCode(code);
        ret.setMessage(Constants.RESPONSE_SUCCESS_MEG);
        ret.setData(data);
        return ret;
    }

    public static Result success(int code, String msg, Object data) {
        Result ret = new Result();
        ret.setCode(code);
        ret.setMessage(msg);
        ret.setData(data);
        return ret;
    }


    public static Result fail(String message) {
        Result ret = new Result();
        ret.setCode(Constants.RESPONSE_FAIL_CODE);
        ret.setMessage(message);
        return ret;
    }

    public static Result fail(int code, String message) {
        Result ret = new Result();
        ret.setCode(code);
        ret.setMessage(message);
        return ret;
    }

}
